-
Notifications
You must be signed in to change notification settings - Fork 482
[Examples] Add create-leo-app examples that execute credits.aleo functions #1177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mainnet
Are you sure you want to change the base?
Conversation
create-leo-app/template-node-credits-aleo-functions-ts/src/index.ts
Outdated
Show resolved
Hide resolved
iamalwaysuncomfortable
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great! Still reviewing, but one comment is that for both examples, can we create an object called Credits which holds the functions within them (and probably an account as well)?
create-leo-app/template-node-credits-aleo-functions-ts/src/index.ts
Outdated
Show resolved
Hide resolved
create-leo-app/template-node-credits-aleo-functions-ts/src/index.ts
Outdated
Show resolved
Hide resolved
create-leo-app/template-node-credits-aleo-functions-ts/src/index.ts
Outdated
Show resolved
Hide resolved
create-leo-app/template-node-credits-aleo-functions-ts/src/index.ts
Outdated
Show resolved
Hide resolved
6011d2b to
a486972
Compare
iamalwaysuncomfortable
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few nits, but overall this is not just understanding the assignment but going beyond and adding to the curriculum. This is GREAT. Thanks for the quick and hard work.
| This template demonstrates building execution transactions for all 6 credits.aleo | ||
| transfer and record manipulation functions in a React application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This template demonstrates building execution transactions for all 6 credits.aleo | |
| transfer and record manipulation functions in a React application. | |
| This template demonstrates building execution transactions for 6 credits.aleo | |
| functions that demonstrate value transfers and record manipulation functions in a React application. |
| 2. Fetches inclusion proofs from the network for private record operations | ||
| 3. Builds complete transactions ready for broadcast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inclusion proof is part of the overall zk proof generated!
| 2. Fetches inclusion proofs from the network for private record operations | |
| 3. Builds complete transactions ready for broadcast | |
| 2. Builds transactions from the proof ready for broadcast |
| owner: aleo1xxx...xxx.private, | ||
| microcredits: 1000000u64.private, | ||
| _nonce: 123...789group.public, | ||
| _version: 1u8.public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| owner: aleo1xxx...xxx.private, | |
| microcredits: 1000000u64.private, | |
| _nonce: 123...789group.public, | |
| _version: 1u8.public | |
| owner: aleo1xxx...xxx.private, // An aleo address that owns the record. | |
| microcredits: 1000000u64.private, // The amount in microcredits contained in the record. | |
| _nonce: 123...789group.public, // The unique nonce identifying the record. | |
| _version: 1u8.public // The version of the record. |
|
|
||
| ### Credits Records | ||
|
|
||
| Private credits in Aleo are stored as records with this structure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Private credits in Aleo are stored as records with this structure: | |
| Private credits in the credits.aleo program (the official representation of value on the Aleo Network) are stored as Aleo records with this structure: |
|
|
||
| ## Notes | ||
|
|
||
| - Network connectivity is required for inclusion proofs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Network connectivity isn't actually always required.
| - Network connectivity is required for inclusion proofs | |
| - Network connectivity is required for this app |
|
|
||
| - Network connectivity is required for inclusion proofs | ||
| - Public function execution takes ~10-15 seconds | ||
| - Private function execution takes ~30-120 seconds (includes network calls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| - Private function execution takes ~30-120 seconds (includes network calls) | |
| - Private function execution takes ~30-120 seconds (Depending on whether keys are locally cached or not) |
|
|
||
| ### Public Transfers | ||
|
|
||
| - **transfer_public**: Transfer credits between public balances |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally code convention in Provable is to use periods in docs and code comments outside of headers. Add them to the text in this doc (minus the headers)
a486972 to
681c783
Compare
681c783 to
5e5f16f
Compare
5e5f16f to
6431ea0
Compare
Motivation
This PR adds Node.js and React create-leo-app templates that build execution transactions for all 6 functions (
transfer_public,transfer_public_to_private,transfer_private,transfer_private_to_public,join,split), giving developers a working reference for each transfer and record operation type.Test Plan
Preview